The Event Manager provides two functions to convert between process serial numbers and port names: GetProcessSerialNumberFromPortName (GetProcessSerialNumberFromPortName) and GetPortNameFromProcessSerialNumber (GetPortNameFromProcessSerialNumber) . Both functions are intended to map serial numbers to port names (or vice versa) for applications open on the local computer. They do not return useful results for applications open on remote computers.
Use GetProcessSerialNumberFromPortName to get the process serial number of a process.
pascal OSErr GetProcessSerialNumberFromPortName
(const PPCPortRec *portName,
ProcessSerialNumber *pPSN);
The GetProcessSerialNumberFromPortName function returns, in the pPSN parameter, a pointer to the process serial number of the process registered at a specific port.
The GetProcessSerialNumberFromPortName function does not move or purge memory but for other reasons should not be called from within an interrupt, such as in a completion routine or VBL task.
Use GetPortNameFromProcessSerialNumber to get the port name of a process.
pascal OSErr GetPortNameFromProcessSerialNumber
(PPCPortRec *portName,
const ProcessSerialNumber *pPSN);
The GetPortNameFromProcessSerialNumber function returns, through the portName parameter, the port name registered to a process having a specific process serial number.
The GetPortNameFromProcessSerialNumber function does not move or purge memory but for other reasons should not be called from within an interrupt, such as in a completion routine or VBL task.
The trap macro and routine selector for the GetPortNameFromProcessSerialNumber function are
_OSDispatch
|